package cool.qingqing.service;

import cool.qingqing.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author 高山青
 * @Date 2021/12/30  -   10:09
 */
@Service
public class UserService {
	public void setUserdao(UserDao userdao) {
		this.userDao = userdao;
	}

	public void setUserName(String userName) {
		this.userName = userName;
		System.out.println("2.set方法注入值");
	}

	public UserService() {
		System.out.println("1.初始化对象");
	}

	@Autowired
	@Qualifier("userDao")
	UserDao userDao;
	private String userName;
	public void add(){
		System.out.println("userName=:"+userName);
		System.out.println("service添加用户");
		userDao.add();
	}
	public void initUserSerivce(){
		System.out.println("3.初始化对象");
	}

	public void endUserSerivce(){
		System.out.println("5.销毁bean对象");
	}
}
